Skip to content

refactor: remove remaining fixed editor assumptions.#105

Merged
knightedcodemonkey merged 5 commits intonextfrom
bananas
Apr 30, 2026
Merged

refactor: remove remaining fixed editor assumptions.#105
knightedcodemonkey merged 5 commits intonextfrom
bananas

Conversation

Copilot AI review requested due to automatic review settings April 30, 2026 18:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors workspace/editor orchestration to remove remaining assumptions about a fixed “component + styles” editor pair, aligning restore/sync/preview flows to the tab-first model (including role: 'entry') and moving render-mode persistence away from localStorage.

Changes:

  • Standardizes “entry” semantics across workspace state (fallback entry tab is now id: 'entry' + role: 'entry') and updates active-tab resolution accordingly.
  • Updates preview runtime to support CSS module imports by providing per-style-tab module export maps and rewriting style imports to virtual module URLs.
  • Removes render-mode localStorage persistence and shifts persistence to workspace save flow; updates GitHub PR sync results to be tab-count based.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/modules/workspace/workspace-tabs-state.js Updates empty-state fallback tab from component to an entry tab.
src/modules/workspace/workspace-tab-shape.js Refactors tab normalization to be role-based (entry vs module) and removes special casing for styles.
src/modules/workspace/workspace-tab-helpers.js Updates active-tab resolution to prefer isActive, then role: 'entry'.
src/modules/preview/render-runtime.js Returns { css, styleModuleExportsByTabId } and passes exports into virtual module planning.
src/modules/preview-runtime/virtual-workspace-modules.js Rewrites style imports to style-module data URLs and caches style-module URLs by tab.
src/modules/preview-runtime/iframe-preview-executor.js Refines suppression of transient “missing reference” runtime errors.
src/modules/github/pr/editor-sync.js Changes sync result shape to syncedTabCount/totalTabCount and removes fixed component/styles sync booleans.
src/modules/app-core/workspace-tab-selectors.js Introduces selectors for active/entry/primary-style tabs (centralized tab lookups).
src/modules/app-core/workspace-tab-mutations-controller.js Refactors add-tab API to `{ type: 'script'
src/modules/app-core/workspace-sync-controller.js Replaces getTabKind with isStyleWorkspaceTab for current-editor source selection and target metadata.
src/modules/app-core/workspace-pr-session-handoff-controller.js Switches fresh local entry tab id/activeTabId to entry.
src/modules/app-core/workspace-editor-helpers.js Replaces loaded tab id refs with internal “tracked tab” bookkeeping and isStyleWorkspaceTab.
src/modules/app-core/workspace-controllers-setup.js Removes renderMode persistence wiring and updates add-tab controller signature.
src/modules/app-core/workspace-context-controller.js Removes persistRenderMode call during record apply.
src/modules/app-core/runtime-editor-utils.js Removes getInitialRenderMode/persistRenderMode localStorage helpers.
src/modules/app-core/runtime-core-setup.js On render-mode change, queues workspace save instead of persisting to localStorage.
src/modules/app-core/publish-trailing-newline-normalizer.js Normalizes trailing newlines using active-tab/editor source abstraction instead of loaded tab ids.
src/modules/app-core/github-workflows.js Updates sync failure result shape to use tab counts.
src/modules/app-core/editor-bootstrap-controller.js Replaces getTabKind usage with isStyleWorkspaceTab for editor bootstrapping.
src/modules/app-core/diagnostics-tab-state-helpers.js Switches diagnostics targeting to entry/primary-style selectors + isStyleWorkspaceTab.
src/modules/app-core/diagnostics-flow-controller.js Simplifies status reset matching and uses isStyleWorkspaceTab for tab-change decisions.
src/modules/app-core/app-composition-options.js Removes render-mode persistence plumbing and loaded styles tab refs from composition.
src/modules/app-core/app-bindings-startup.js Updates tab-add actions and simplifies initial styles seeding logic.
src/app.js Integrates new selectors/tracked-tab approach, removes render-mode localStorage usage, updates initial tabs to entry.
playwright/workspace-tabs.spec.ts Updates seed logic and add-tab helper usage to role/type-based APIs.
playwright/rendering-modes/core.spec.ts Adds CSS-module import coverage, strengthens persistence assertions via IDB snapshot polling, updates add-tab calls.
playwright/helpers/app-test-helpers.ts Changes addWorkspaceTab helper to `{ type: 'script'
playwright/github-pr-drawer/open-pr-create.spec.ts Updates expectations for entry detection via role: 'entry' and add-tab helper usage.
playwright/github-pr-drawer/github-pr-drawer.helpers.ts Updates seeded workspace contexts to use entry and role-based lookups.
playwright/github-pr-drawer/active-context-sync.spec.ts Updates primary-tab detection assertions to role/language-based checks.
playwright/github-pr-drawer/active-context-switch.spec.ts Updates primary-tab detection assertions to role/language-based checks.
Comments suppressed due to low confidence (1)

src/modules/workspace/workspace-tab-shape.js:30

  • createEnsureWorkspaceTabsShape only treats tabs with role === 'entry' as the entry tab. Any legacy workspace records that still use the old id === 'component' (or that omit role) will be treated as module tabs, and this function will prepend a new id: 'entry' tab. That can create duplicate App tabs (same path/moduleKey) and can effectively “lose” the user’s previous entry content/active tab on restore. Consider recognizing legacy entry tabs (e.g., tab.id === 'component' or isPreviewEntryTab-style path/name heuristics) and normalizing them into role: 'entry' instead of inserting a new entry tab.
    const hasEntryTab = inputTabs.some(tab => tab?.role === 'entry')
    const nextTabs = [...inputTabs]

    if (!hasEntryTab) {
      nextTabs.unshift({
        id: 'entry',
        name: defaultComponentTabName,
        path: defaultComponentTabPath,
        language: 'javascript-jsx',
        role: 'entry',
        content: defaultJsx,
        isActive: true,
      })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/app-core/app-bindings-startup.js Outdated
@knightedcodemonkey knightedcodemonkey merged commit e1208e9 into next Apr 30, 2026
6 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch April 30, 2026 18:53
knightedcodemonkey added a commit that referenced this pull request May 2, 2026
* feat: idb infrastructure. (#63)

* feat: dynamic tabs. (#64)

* refactor: better accessbility for tabs. (#68)

* feat: remove allow-same-origin for better security. (#69)

* feat: tab reordering via drag-n-drop. (#70)

* feat: explicit css imports, diagnostics per editor buffer. (#71)

* feat: idb + github sync with atomic open and push to remote. (#78)

* closes #73, closes #74, closes #75.

* refactor: more colocation and smaller file sizes. (#79)

* refactor: improvements with styles and gh syncs. (#82)

* test: webkit flake. (#83)

* test: address flake. (#84)

* refactor: github pr context. (#85)

* fix: require app in entry, hide workspaces without pat, remove star important. (#86)

* feat: make idb source of truth for pr context. (#87)

* fix: active pr context on reload and dedupe workspace identity. (#88)

* fix: edited and push sync across reloads. (#89)

* fix: properly commit tab name changes. (#90)

* fix(tabs): filename edits, min-widths, scrolling, content sync. (#91)

* feat: improved workspace disconnect and closed ux. (#92)

* refactor: status styling and biome config. (#94)

* fix(diagnostics): enforce current-editor snapshots and stale results. (#95)

* fix: consistent head handling. (#96)

* fix: prevent workspace overwrites. (#100)

* fix(playwright): stabilize lint diagnostics waits with one-time rerun fallback. (#101)

* feat: improved workspace ux and state identity separation.  (#103)

* fix: iframe protocol mismatch in receiver reads. (#104)

* refactor: remove remaining fixed editor assumptions. (#105)

* refactor: simplify PR close flow with deterministic workspace state updates (#106)

* feat: mode-aware entry tab extensions. (#108)

* feat: workspace status bar. (#109)

* feat: tab-scoped ai chat. (#111)

* refactor: better workspace drawer ux. (#112)

* refactor: remove collapsible editors and update breakpoint styles. (#113)

* docs: update for vnext. (#114)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants